import axios from '@/request/http'
import { commonOutDTO, pageCommonInputDTO, pageCommonOutDTO } from '@/api/common.d'
import {
  SjyDeleteInputDTO,
  SjySaveInputDTO,
  SjyQueryParam,
  SjyQueryResult,
  SjyTestInputDTO,
  SjyTestOutputDTO,
  NcSjyTestInputDTO,
  SjyfzDeleteInputDTO,
  SjyfzSaveInputDTO,
  SjyfzQueryResult,
  testWbsjyljInputDTO,
} from './sjygl-dto'

export default class sjyglService {
  /**
   * 删除数据源
   */
  static deleteSjy (data: SjyDeleteInputDTO): Promise<commonOutDTO<null>> {
    return axios.post('/api/sjygl/deleteSjy', data)
  }
  /**
   * 保存数据源
   */
  static saveSjy (data: SjySaveInputDTO): Promise<commonOutDTO<null>> {
    return axios.post('/api/sjygl/saveSjy', data)
  }
  /**
   * 分页查询数据源
   */
  static querySjy (
    data: pageCommonInputDTO<SjyQueryParam>,
  ): Promise<commonOutDTO<pageCommonOutDTO<SjyQueryResult[]>>> {
    return axios.post('/api/sjygl/querySjy', data)
  }
  /**
   * 测试数据源
   */
  static testSjy (data: SjyTestInputDTO): Promise<commonOutDTO<SjyTestOutputDTO>> {
    return axios.post('/api/sjygl/testSjy', data)
  }
  /**
   * 测试内部数据源连接
   */
  static testNcsjyljy (data: NcSjyTestInputDTO): Promise<commonOutDTO<boolean>> {
    return axios.post('/api/sjygl/testNcsjylj', data)
  }
  /**
   * 删除数据源分组
   */
  static deleteSjyfz (data: SjyfzDeleteInputDTO): Promise<commonOutDTO<null>> {
    return axios.post('/api/sjyfz/deleteSjyfz', data)
  }
  /**
   * 保存数据源分组
   */
  static saveSjyfz (data: SjyfzSaveInputDTO): Promise<commonOutDTO<null>> {
    return axios.post('/api/sjyfz/saveSjyfz', data)
  }
  /**
   * 查询数据源分组
   */
  static querySjyfz (): Promise<commonOutDTO<SjyfzQueryResult[]>> {
    return axios.post('/api/sjyfz/querySjyfz', {})
  }
  /**
   * 查询数据源模式名
   */
  static querySjymsm (data: unknown): Promise<commonOutDTO<unknown>> {
    return axios.post('/api/sjygl/querySjymsm', data)
  }
  /**
   * 获取数据源信息
   */
  static getSjyxxjm (data: unknown): Promise<commonOutDTO<unknown>> {
    return axios.post('/api/sjygl/getSjyxxjm', data)
  }
  /**
   * 测试外部数据源连接
   */
  static testWbsjylj (data: testWbsjyljInputDTO): Promise<commonOutDTO<unknown>> {
    return axios.post('/api/sjygl/testWbsjylj', data)
  }
}
